import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 预约状况查询
export const queryBookingInformation = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/queryBookingInformation`, {
    params
  });
// 确定保存
export const saveBookingInformation = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/saveBookingInformation`, params);
// VIN选择
export const queryChooseVin = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/chooseVin`, {
    params
  });
// 查询预约情况
export const queryLimit = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/bookingLimit`, {
    params
  });
// 查询预约情况-预约单列表
export const queryLimitOrder = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/bookingLimitOrder`, {
    params
  });
// 根据vin和车牌号查询预约单号
export const findBookingRecord = (vin, license) => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/${vin}/${license}`, {});
// 根据vin和车牌号查询预约单号
export const findBookingRecords = (vin, license) => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/bookingOrder/${vin}`, {});
// 根据预约单号查询
export const findBookingOrder = bookingOrderNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/${bookingOrderNo}`, {});
// 根据预约单号查询维修项目
export const findBookingOrderLabour = bookingOrderNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/findBookingOrderLabour/${bookingOrderNo}`, {});
// 根据预约单号查询预约备件
export const queryPartBooking = bookingOrderNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/queryPartBooking/${bookingOrderNo}`, {});
// 根据预约单号查询附加项目
export const queryAddItemBooking = bookingOrderNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/queryAddItemBooking/${bookingOrderNo}`, {});
// 根据预约单号查询预约工具
export const queryToolBooking = bookingOrderNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/queryToolBooking/${bookingOrderNo}`, {});
// 查询推荐人
export const selectEmployee = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/selectEmployee`, {
    params
  });
// 查询推荐单位
export const selectOwner = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/selectOwner`, {
    params
  });
// 解锁预约单
export const unlick = bookingOrderNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/unlick/${bookingOrderNo}`);
// 根据vin查询车牌号
export const VinByLicense = vin => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/VinByLicense/${vin}`);
// 查询预约提醒记录
export const queryBookingPrompt = BookingOrderNo => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/queryBookingPrompt/${BookingOrderNo}`, {});
// 预约状况查询----提醒记录-保存按钮
export const btnSave = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/btnSave`, params);
// 预约状况查询----取消预约
export const cancelBookingOrder = params => axios.put(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/cancelBookingOrder`, params);
// APP----取消预约
export const cancelAPP = params => axios.put(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/canceAPP`, params);

// 按钮维修建议-查询维修建议备件
export const querySuggestMaintainPartJoinStock = vin => axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/querySuggestMaintainPartJoinStock/${vin}`, {});

// 新增备件查询
export const partStocks = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/partStocks`, {
    params
  });

// 查询车主
export const getOwner = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/getOwner`, {
    params
  });

// 检查结果
export const troubleDesc = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/troubleDesc`, {
    params
  });

// 附加项目名称
export const queryItemCode = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/appendProject/appendProject/dicts`, {
    params
  });

// 预估单价
export const labourpriceItem = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedataRepairtypes/labourpriceItem`, {
    params
  });

// 修改预约单锁定人
export const updateLockUser = (bookingOrderNo, type) => axios.post(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/updateLockUser/${bookingOrderNo}/${type}`, {});

// 上传行动预约单
export const moveUpload = params => axios.post(`${SERVER.DMSCLOUD_CUSTOMERREPAIR}/order/repair/upload`, params);

//  将预约来源为APP的状态发送至APP
export const APPUpload = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/canceAPP`, params);

// 导出
export const exportPrecontractStatus = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/precontractStatus/export`, {
    params,
    responseType: 'arraybuffer'
  });
